﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PROD_WORKCENTERS
// * CreateDate    : 2013-02-19 16:50:56
// * Creater       : CodeSmith
// * LastChangeDate: 2013-02-19 16:50:56
// * LastChanger   : 2013-02-19 16:50:56
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;
using ESOL.Common;

namespace ESOL.Business.Prod
{
    /// <summary>
    /// ProdWorkcenters
    /// </summary>
    public partial class ProdWorkcentersBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objProdWorkcentersEntity">Entity</param>
        /// <returns>Entity</returns>
        public static ProdWorkcentersEntity GetProdWorkcenters(ProdWorkcentersEntity objProdWorkcentersEntity)
        {
            return DataAccess.SelectSingle<ProdWorkcentersEntity>(objProdWorkcentersEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objProdWorkcentersEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertProdWorkcenters(ProdWorkcentersEntity objProdWorkcentersEntity)
        {
            return DataAccess.Insert(objProdWorkcentersEntity);
        }

        public static bool InsertProdWorkcenters(List<ProdWorkcentersEntity> objProdWorkcentersEntityList)
        {
            return DataAccess.Insert(objProdWorkcentersEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objProdWorkcentersEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateProdWorkcenters(ProdWorkcentersEntity objProdWorkcentersEntity)
        {
            return DataAccess.Update(objProdWorkcentersEntity);
        }

        public static bool UpdateProdWorkcenters(List<ProdWorkcentersEntity> objProdWorkcentersEntityList)
        {
            return DataAccess.Update<ProdWorkcentersEntity>(objProdWorkcentersEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objProdWorkcentersEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteProdWorkcenters(ProdWorkcentersEntity objProdWorkcentersEntity)
        {
            return DataAccess.Delete(objProdWorkcentersEntity);
        }

        public static bool DeleteProdWorkcenters(List<ProdWorkcentersEntity> objProdWorkcentersEntityList)
        {
            return DataAccess.Delete<ProdWorkcentersEntity>(objProdWorkcentersEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetProdWorkcentersAll()
        {
            return DataAccess.SelectAllDataSet<ProdWorkcentersEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<ProdWorkcentersEntity> GetProdWorkcentersAllList()
        {
            return DataAccess.SelectAll<ProdWorkcentersEntity>();
        }
        #endregion

        #region Functions
        public static List<ProdWorkcentersEntity> GetAllForCondition(string condition, string orderBy, string rowCount)
        {
            string sql = CommonFunctions.GetSelect(rowCount) + @" * from PROD_WORKCENTERS
                WHERE 1=1 ";
            if (string.IsNullOrEmpty(condition) == false)
            {
                sql += condition;
            }
            if (string.IsNullOrEmpty(orderBy) == false)
            {
                sql += " ORDER BY " + orderBy;
            }
            return DataAccess.Select<ProdWorkcentersEntity>(sql);
        }
        #endregion
    }


}

